angular.module("lamallApp")
.controller("home_babyController",function($scope,home_babyService){
	// 改变排版 
	$scope.isActive = true; 
	$scope.changeType = function(){
		 $scope.isActive = ! $scope.isActive; 
	}
	$scope.yxk_orderKey = "$$hashKey";
		// 是否有货
	$scope.ishave = true; 
	$scope.changeHave = function(){
		 $scope.ishave = !$scope.ishave;
		 $scope.yxk_orderKey = ($scope.ishave==false)?"discount":"";
		 $scope.yxk_bol = ($scope.ishave==false)?"false":"";  
	}
	// 人气
	$scope.ismoods = true; 
	$scope.changeMoods = function(){
		 $scope.ismoods = ! $scope.ismoods;
		 $scope.yxk_orderKey = ($scope.ismoods==false)?"sold_number":"";
		 $scope.yxk_bol = ($scope.ismoods==false)?"false":""; 
	}
	// 改变价格
	$scope.i = 0;
	$scope.j = $scope.i+1;
	$scope.k = $scope.i+2; 
	$scope.changePrice = function(){
		 $scope.i = ($scope.i+1)>2?0:($scope.i+1);
		 $scope.j = ($scope.j+1)>2?0:($scope.j+1);
		 $scope.k = ($scope.k+1)>2?0:($scope.k+1);
		 $scope.yxk_orderKey = ($scope.j==0||$scope.k==0)?"shop_price":"";
		 $scope.yxk_bol = ($scope.j==0)?"false":"";
	}
	
	// 筛选
	$scope.isChoice = false; 
	$scope.isCover = false;
	$scope.changeChoice = function(){
		 $scope.isChoice = true;
		 $scope.isCover = true; 
	}
	//改变品牌
	$scope.isBrand = false; 
	$scope.changeBrand = function(){
		 $scope.isBrand = !$scope.isBrand; 
	}
   // 添加数据到已选择
    $scope.tags=[{name:'全部',code:1},{name:'南极人',code:2},{name:'大哥',code:3},{name:'花笙糖',code:4},{name:'MOSREM',code:5}];
    $scope.x = 1;
    $scope.selectedTag=$scope.selectedTag1=10;
   	$scope.onSelect=function(tag){
		 $scope.selectedTag=tag;
   	}
   	$scope.tagall=[{content:'全部',code:1}];
   	$scope.onSelect1=function(tag){
		 $scope.selectedTag1=tag;
   	}
   	/*显示，隐藏*/
   	$scope.onReset = function(){
   		$scope.isCover = false;
   		$scope.isChoice = false; 
   		$scope.yxk_orderKey = "$$hashKey";
		$scope.yxk_bol = "";  
		$scope.selectedTag=$scope.selectedTag1=10;
   	}
   	$scope.onSure = function(){
   		$scope.isCover = false;
   	}
    home_babyService.getItems(function(res){
    	$scope.special = res.data.special;
    	$scope.goods = res.data.goods;
    })
    // 倒计时
    $scope.vm = {
        serverTime:1484308452,             //服务器时间戳
        createTime:'2017-02-13 21:00:00'   //创建时间
    };
    $scope.testDate = new Date( parseInt($scope.vm.serverTime) * 1000).toLocaleDateString(); 
});